﻿/**
  ******************************************************************************
  * @file    Libraries/Device/JS32T031/js32t031_selfcheck.h
  * @author  JUSHENG Application Team
  * @version V1.0.0
  * @date    02-19-2022
  * @brief   
  *
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; COPYRIGHT 2022 JUSHENG</center></h2>
  *
  *
  *
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __JS32T031_SELFCHECK_H
#define __JS32T031_SELFCHECK_H

#ifdef __cplusplus
 extern "C" {
#endif



/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include "typedef.h"
#include "js32t031.h"

/* Private define ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/

/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
#define RAM_START_ARRD           0x20000000
#define RAM_STACK_LEN            0x200
#define RAM_LEN                  4*1024    

#define STARTUP_CPU_CHECK_EN     1
#define STARTUP_CLK_CHECK_EN     1

#define STARTUP_RAM_STACK_EN     1
#define STARTUP_RAM_EN           1  

#define RUNTIME_CPU_CHECK_EN     1
#define RUNTIME_CLK_CHECK_EN     1

#define RUNTIME_RAM_EN           1

#define RUNTIME_FLASH_LEN        0//0x8000     

void SelfCheckError(void);
__asm void __cpu_check(void);
__asm void __cpu_r1_r12_check(void);
void __ram_check_all(u32* start_addr, u16 len);
void __ram_check_up(u32* start_addr, u16 len);
void __ram_check_down(u32* start_addr, u16 len);
void __clk_check(u32 u_thrd, u32 l_thrd);
void __flash_check(u16 len);

void selfcheck_runtime_init(void);
void selfcheck_runtime(void);

#ifdef __cplusplus
}
#endif

#endif //__JS32T031_SELFCHECK_H

/*************************** (C) COPYRIGHT 2022 JUSHENG ***** END OF FILE *****/
